﻿@model BusinessPromotionsListViewModel
@{
    ViewBag.Title = "Business Promotions";
    Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
}
<!--start bradecums-->
<div class="bradecums_bar">
    Business Profile Screens <span>&raquo;</span>
    @((Model.BusinessId > 0) ? Model.BusinessName : "Add New Business")
    <span>&raquo;</span> General Info</div>
<!--end bradecums-->
<!--start button-->
<div class="zatify_panel_btn2">
    @Html.Partial("Partials/BusinessDetailsTabsControl", new BusinessDetailsTabsViewModel() { BusinessId = @Model.BusinessId, BusinessSection = BusinessSection.GeneralInfo })
    <div class="clearfix">
    </div>
</div>
<!--end button-->
<!--start promotions table-->
<div class="zatify_payment_info_tabel">
    <div class="zatify_table_content">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <th width="5%">
                    ID
                </th>
                <th width="8%">
                    Dates
                </th>
                <th width="17%">
                    Promotion Name
                </th>
                <th width="9%">
                    Status
                </th>
                <th width="10%">
                    Total Budget
                </th>
                <th width="9%">
                    Used Budget
                </th>
                <th width="9%">
                    Remaining Budget
                </th>
                <th width="6%">
                    Pushes
                </th>
                <th width="6%">
                    Check-Ins
                </th>
                <th width="7%">
                    Cost Per Push
                </th>
                <th width="7%">
                    Fixed Cost
                </th>
                <th width="7%">
                    Today's Code
                </th>
            </tr>
            @foreach (var promotion in Model.Promotions)
            {
                <tr>
                    <td>
                        @promotion.PromotionId
                    </td>
                    <td>
                        @(promotion.BaseCostTimingScheduledAt.HasValue ? promotion.BaseCostTimingScheduledAt.Value.ToShortDateString() : String.Empty)
                    </td>
                    <td>
                        <a href="@Url.Action("Promotion", "Business", new { businessId = @promotion.BusinessId, id = @promotion.PromotionId })">
                            @promotion.Name
                        </a>
                    </td>
                    <td>
                        @switch (promotion.StatusCode)
                        {
                            case "ACT":
                            <text>Active</text>
                                break;
                            case "PEN":
                            <text>Pending</text>
                                break;
                            case "COM":
                            <text>Completed</text>
                                break;
                        }
                    </td>
                    <td>
                        $@(promotion.CampaignBudget.HasValue ? promotion.CampaignBudget.Value.ToString("0.00") : "0.00")
                    </td>
                    <td>
                        $@(promotion.SpentMoney.HasValue ? promotion.SpentMoney.Value.ToString("0.00") : "0.00")
                    </td>
                    <td>
                        $@(promotion.UnusedMoney.HasValue ? promotion.UnusedMoney.Value.ToString("0.00") : "0.00")
                    </td>
                    <td>
                        @promotion.SpentPushes
                    </td>
                    <td>
                        @promotion.CheckIns
                    </td>
                    <td>
                        $@(promotion.RatePerPush.HasValue ? promotion.RatePerPush.Value.ToString("0.00") : "0.00")
                    </td>
                    <td>
                        $@(promotion.FixedCost.HasValue ? promotion.FixedCost.Value.ToString("0.00") : "0.00")
                    </td>
                    <td>
                        @promotion.CheckinCode
                    </td>
                </tr>
            }
        </table>
    </div>
    <div class="clearfix">
    </div>
    <!--end promotions table-->
</div>
<!--start pagination-->
<div class="zatify_pagination">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            @Html.PageLinks(Model.PagingInfo, x => Url.Action("Promotions", new { id = Model.BusinessId, page = x }),
                           Url.Content("~/Areas/Admin/Content/zatify/Images/page_first_btn.png"),
                           Url.Content("~/Areas/Admin/Content/zatify/Images/page_last_btn.png"),
                           Url.Content("~/Areas/Admin/Content/zatify/Images/page_back.png"),
                           Url.Content("~/Areas/Admin/Content/zatify/Images/page_next.png"))
            <td width="24%">
            </td>
            <td width="6%">
                Page No:
            </td>
            <td width="55%">
                @using (Html.BeginForm("Promotions", "Business", FormMethod.Post, new { id = "formPages" }))
                {
                    @Html.Hidden("id", Model.BusinessId)
                    @Html.DropDownList("page", (IEnumerable<SelectListItem>)ViewData["pagesCount"], new { onchange = "$('#formPages').submit();", @class = "select_box" })
                }
            </td>
            <td width="15%">
                <span class="page_no_info">@Model.PagingInfo.TotalItems items in @Model.PagingInfo.TotalPages
                    pages</span>
            </td>
        </tr>
    </table>
</div>
<div class="clearfix">
</div>
<!--end pagination-->
